home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / RESOURCES / CH2 / LoopPrint.cs < prev    next >
Text File  |  2006-05-29  |  737b  |  20 lines

  1. // ========================================================================
  2. //  LoopPrint.cs
  3. //
  4. //  Solution to while challenge
  5. // ========================================================================
  6.  
  7. function runLoopPrint()
  8. // ----------------------------------------------------
  9. //     Entry point for the program.
  10. // ----------------------------------------------------
  11. {
  12.    %value = 0;            // initialize %n
  13.    while (%value < 250)     // stop looping if %n exceeds 250
  14.    {
  15.       %value = GetRandom(350); // get a random number between 0 and 350
  16.       echo("n="@%value);     // print the result
  17.    }                      // back to the top of the loop
  18.                           // ie. do it all again
  19. }
  20.